﻿// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_PROD_WORKCENTERS_PERSON
// * CreateDate    : 2013-02-19 16:55:28
// * Creater       : CodeSmith
// * LastChangeDate: 2013-02-19 16:55:28
// * LastChanger   : 2013-02-19 16:55:28
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Suzsoft.Smart.Data;
using ESOL.Common.Entity;

namespace ESOL.Business.Prod
{
    /// <summary>
    /// ProdWorkcentersPerson
    /// </summary>
    public partial class ProdWorkcentersPersonBs
    {
        #region GetByID
        /// <summary>
        /// Get Entity
        /// </summary>
        /// <param name="objProdWorkcentersPersonEntity">Entity</param>
        /// <returns>Entity</returns>
        public static ProdWorkcentersPersonEntity GetProdWorkcentersPerson(ProdWorkcentersPersonEntity objProdWorkcentersPersonEntity)
        {
            return DataAccess.SelectSingle<ProdWorkcentersPersonEntity>(objProdWorkcentersPersonEntity);
        }
        #endregion


        #region Insert
        /// <summary>
        /// Insert Data
        /// </summary>
        /// <param name="objProdWorkcentersPersonEntity">Entity</param>
        /// <returns>true Insert Succeed; false Insert Fail</returns>
        public static bool InsertProdWorkcentersPerson(ProdWorkcentersPersonEntity objProdWorkcentersPersonEntity)
        {
            return DataAccess.Insert(objProdWorkcentersPersonEntity);
        }

        public static bool InsertProdWorkcentersPerson(List<ProdWorkcentersPersonEntity> objProdWorkcentersPersonEntityList)
        {
            return DataAccess.Insert(objProdWorkcentersPersonEntityList);
        }
        #endregion


        #region Update
        /// <summary>
        /// Update Data
        /// </summary>
        /// <param name="objProdWorkcentersPersonEntity">Entity</param>
        /// <returns>true Update Succeed; false Update Fail</returns>
        public static bool UpdateProdWorkcentersPerson(ProdWorkcentersPersonEntity objProdWorkcentersPersonEntity)
        {
            return DataAccess.Update(objProdWorkcentersPersonEntity);
        }

        public static bool UpdateProdWorkcentersPerson(List<ProdWorkcentersPersonEntity> objProdWorkcentersPersonEntityList)
        {
            return DataAccess.Update<ProdWorkcentersPersonEntity>(objProdWorkcentersPersonEntityList);
        }
        #endregion


        #region Delete
        /// <summary>
        /// Delete Data
        /// </summary>
        /// <param name="objProdWorkcentersPersonEntity">Entity</param>
        /// <returns>true Delete Succeed; false Delete Fail</returns>
        public static bool DeleteProdWorkcentersPerson(ProdWorkcentersPersonEntity objProdWorkcentersPersonEntity)
        {
            return DataAccess.Delete(objProdWorkcentersPersonEntity);
        }

        public static bool DeleteProdWorkcentersPerson(List<ProdWorkcentersPersonEntity> objProdWorkcentersPersonEntityList)
        {
            return DataAccess.Delete<ProdWorkcentersPersonEntity>(objProdWorkcentersPersonEntityList);
        }
        #endregion


        #region GetAll
        /// <summary>
        /// Get All Data
        /// </summary>
        /// <returns>Back All Data<returns>
        public static DataSet GetProdWorkcentersPersonAll()
        {
            return DataAccess.SelectAllDataSet<ProdWorkcentersPersonEntity>();
        }
        /// <summary>
        /// Get All Data List
        /// </summary>
        /// <returns>Back All Data List<returns>
        public static List<ProdWorkcentersPersonEntity> GetProdWorkcentersPersonAllList()
        {
            return DataAccess.SelectAll<ProdWorkcentersPersonEntity>();
        }
        #endregion

        #region functions
        public static List<ProdWorkcentersPersonEntity> GetAllListForCode(string sWorkCenterCode)
        {
            string sql = @"select * from PROD_WORKCENTERS_PERSON where WORKCENTERS_CODE='"+sWorkCenterCode+"'";
            return DataAccess.Select<ProdWorkcentersPersonEntity>(sql);
        }


        public static DataTable GetAllDtForCode(string sWorkCenterCode)
        {
            string sql = @"select * from PROD_WORKCENTERS_PERSON where WORKCENTERS_CODE='" + sWorkCenterCode + "'";
            return DataAccess.SelectDataSet(sql).Tables[0];
        }
        #endregion
    }


}

